package com.basic.enums;

/**
 * @author Duan SanMao
 * @date 2021/8/18
 */

public abstract interface BaseEnum<T>{

    /**
     *
     * @return
     */
    public abstract T getCode();


    default boolean equals(String code){
        if(code == null){
            return  false;
        }
        if(getCode() instanceof  Integer){
            return getCode().toString().equals(code);
        }
        return getCode().equals(code);
    }

    default boolean equals(Integer code){
        if(code == null){
            return  false;
        }
        if(getCode() instanceof  String){
            return getCode().equals(code.toString());
        }
        return getCode().equals(code);
    }



}
